//
//  KBAlbumsHearderView.m
//  喜马拉雅改良版框架
//
//  Created by dllo on 15/12/25.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "KBAlbumsHearderView.h"

@implementation KBAlbumsHearderView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
    {
        [self createSubViews];
    }
    return self;
}
- (void)createSubViews
{
    _goBack = [[UIImageView alloc] init];
    _goBack.image = [UIImage imageNamed:@"icon_back@3x.png"];
    _goBack.userInteractionEnabled = YES;
    [self addSubview:_goBack];
    [_goBack mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(30);
        make.left.mas_equalTo(25);
        make.width.mas_equalTo(28);
        make.height.mas_equalTo(28);
    }];

    
    // 标题
    _titleLabel = [[UILabel alloc] init];
    _titleLabel.textColor = [UIColor whiteColor];
    _titleLabel.font = [UIFont systemFontOfSize:25];
    _titleLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_titleLabel];
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(30);
        make.left.mas_equalTo(45);
//        make.right.mas_equalTo(0);
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(335);
    }];
    
    
    // 专辑图片
    _coverOrigin = [[UIImageView alloc] init];
    _coverOrigin.image = [UIImage imageNamed:ImagePlaceHolder];
    [self addSubview:_coverOrigin];
    [_coverOrigin mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(30);
        make.top.mas_equalTo(self.bounds.origin.y).offset(100);
        //        make.size.mas_equalTo(CGSizeMake(90, 90));
        make.width.and.height.mas_equalTo(90);
        
    }];
    
    // 主播图片
    _avatarPath = [[UIImageView alloc] init];
    _avatarPath.image = [UIImage imageNamed:ImagePlaceHolder];
    [self addSubview:_avatarPath];
    _avatarPath.layer.masksToBounds = YES; // 允许剪切
    _avatarPath.layer.cornerRadius = 35/2; // 裁圆
    _avatarPath.layer.borderWidth = 1; // 边框
    [_avatarPath mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_coverOrigin.mas_top).offset(8);
        make.left.equalTo(_coverOrigin.mas_right).offset(10);
        //        make.size.mas_equalTo(CGSizeMake(35, 35));
        make.width.and.height.mas_equalTo(35);
        
    }];
    
    // 主播名
    _nikename = [[UILabel alloc] init];
    _nikename.textColor = [UIColor whiteColor];
    [self addSubview:_nikename];
    [_nikename mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_avatarPath.mas_top).offset(8);
        make.left.equalTo(_avatarPath.mas_right).offset(5);
        make.width.mas_equalTo(170);
        make.height.mas_equalTo(20);
    }];
    
    // 简介
    _intro = [[UILabel alloc] init];
    _intro.text = @"暂无简介";
    _intro.textColor = [UIColor whiteColor];
    _intro.alpha = 0.7;
    _intro.font = [UIFont systemFontOfSize:14];
    [self addSubview:_intro];
    [_intro mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_avatarPath.mas_bottom).offset(16);
        make.left.equalTo(_avatarPath.mas_left);
        make.width.mas_equalTo(230);
        make.height.mas_equalTo(18);
    }];
    
}


/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

@end
